/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.cosmact.vxml.model.impl;

import org.cosmact.vxml.model.Dialog;
import org.cosmact.vxml.model.DialogXmlContent;
import org.cosmact.vxml.model.ModelPackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Dialog Xml Content</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.cosmact.vxml.model.impl.DialogXmlContentImpl#getContent <em>Content</em>}</li>
 *   <li>{@link org.cosmact.vxml.model.impl.DialogXmlContentImpl#getDialog <em>Dialog</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class DialogXmlContentImpl extends EObjectImpl implements DialogXmlContent {
	/**
         * The default value of the '{@link #getContent() <em>Content</em>}' attribute.
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @see #getContent()
         * @generated
         * @ordered
         */
	protected static final String CONTENT_EDEFAULT = null;

	/**
         * The cached value of the '{@link #getContent() <em>Content</em>}' attribute.
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @see #getContent()
         * @generated
         * @ordered
         */
	protected String content = CONTENT_EDEFAULT;

	/**
         * The cached value of the '{@link #getDialog() <em>Dialog</em>}' reference.
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @see #getDialog()
         * @generated
         * @ordered
         */
	protected Dialog dialog;

	/**
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @generated
         */
	protected DialogXmlContentImpl() {
                super();
        }

	/**
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @generated
         */
	@Override
	protected EClass eStaticClass() {
                return ModelPackage.Literals.DIALOG_XML_CONTENT;
        }

	/**
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @generated
         */
	public String getContent() {
                return content;
        }

	/**
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @generated
         */
	public void setContent(String newContent) {
                String oldContent = content;
                content = newContent;
                if (eNotificationRequired())
                        eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.DIALOG_XML_CONTENT__CONTENT, oldContent, content));
        }

	/**
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @generated
         */
	public Dialog getDialog() {
                if (dialog != null && dialog.eIsProxy()) {
                        InternalEObject oldDialog = (InternalEObject)dialog;
                        dialog = (Dialog)eResolveProxy(oldDialog);
                        if (dialog != oldDialog) {
                                if (eNotificationRequired())
                                        eNotify(new ENotificationImpl(this, Notification.RESOLVE, ModelPackage.DIALOG_XML_CONTENT__DIALOG, oldDialog, dialog));
                        }
                }
                return dialog;
        }

	/**
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @generated
         */
	public Dialog basicGetDialog() {
                return dialog;
        }

	/**
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @generated
         */
	public void setDialog(Dialog newDialog) {
                Dialog oldDialog = dialog;
                dialog = newDialog;
                if (eNotificationRequired())
                        eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.DIALOG_XML_CONTENT__DIALOG, oldDialog, dialog));
        }

	/**
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @generated
         */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
                switch (featureID) {
                        case ModelPackage.DIALOG_XML_CONTENT__CONTENT:
                                return getContent();
                        case ModelPackage.DIALOG_XML_CONTENT__DIALOG:
                                if (resolve) return getDialog();
                                return basicGetDialog();
                }
                return super.eGet(featureID, resolve, coreType);
        }

	/**
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @generated
         */
	@Override
	public void eSet(int featureID, Object newValue) {
                switch (featureID) {
                        case ModelPackage.DIALOG_XML_CONTENT__CONTENT:
                                setContent((String)newValue);
                                return;
                        case ModelPackage.DIALOG_XML_CONTENT__DIALOG:
                                setDialog((Dialog)newValue);
                                return;
                }
                super.eSet(featureID, newValue);
        }

	/**
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @generated
         */
	@Override
	public void eUnset(int featureID) {
                switch (featureID) {
                        case ModelPackage.DIALOG_XML_CONTENT__CONTENT:
                                setContent(CONTENT_EDEFAULT);
                                return;
                        case ModelPackage.DIALOG_XML_CONTENT__DIALOG:
                                setDialog((Dialog)null);
                                return;
                }
                super.eUnset(featureID);
        }

	/**
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @generated
         */
	@Override
	public boolean eIsSet(int featureID) {
                switch (featureID) {
                        case ModelPackage.DIALOG_XML_CONTENT__CONTENT:
                                return CONTENT_EDEFAULT == null ? content != null : !CONTENT_EDEFAULT.equals(content);
                        case ModelPackage.DIALOG_XML_CONTENT__DIALOG:
                                return dialog != null;
                }
                return super.eIsSet(featureID);
        }

	/**
         * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
         * @generated
         */
	@Override
	public String toString() {
                if (eIsProxy()) return super.toString();

                StringBuffer result = new StringBuffer(super.toString());
                result.append(" (content: ");
                result.append(content);
                result.append(')');
                return result.toString();
        }

} //DialogXmlContentImpl
